<template>
	<!-- 核销订单详情 -->
	<view class="details_wp">
		<view class="d_bg"></view>
		<view class="d_body">
			<!-- <view class="d_buyers">
				<view>买家信息</view>
				<view class="d_b_info">
					<text class="yticon icon-icon-test"></text>
					<view class="d_b_address">
						<view>{{info.order.address.province}}/{{info.order.address.city}}/{{info.order.address.area}}
							{{info.order.address.address}}</view>
						<view class="d_b_name">{{info.order.address.realname}} {{info.order.address.mobile}}</view>
					</view>
				</view>
			</view> -->

			<view class="d_shop">
				<view class="d_s_head">
					<view>买家：{{info.order.address.realname}}</view>
					<text @click="makePhoneCall" class="iconfont icon-kefu">联系买家</text>
				</view>
				<view class="d_s_body" v-for="item in info.orderGoods" :key="item.id">
					<image :src="item.thumb" mode=""></image>
					<view class="d_s_i_info">
						<view class="d_s_i_name">{{item.goodstitle}}</view>
						<view class="d_s_i_price"><text>{{item.realprice}}米币 <text v-if="item.optionname" style="margin-left: 30upx;">规格:{{item.optionname}}</text></text>
							<view><text>×{{item.total}}</text></view>
						</view>
					</view>
				</view>
				<view class="d_s_list">
					<view>运费</view>
					<view>{{info.order.dispatchprice}}</view>
				</view>
				<view class="d_s_list">
					<view>服务费</view>
					<view>{{info.order.servicefee}}</view>
				</view>
				<view class="d_s_list" v-if="info.order.remark">
					<view>订单备注</view>
					<view>{{info.order.remark}}</view>
				</view>
				<view class="d_s_statistics">
					<text>小计：</text>
					<text>{{info.order.price}}</text>
				</view>
			</view>
			<view class="d_order">
				<view class="d_o_title">订单信息</view>
				<view class="d_o_list">
					<text>订单编号</text>
					<text :selectable="true">{{info.order.ordersn}}</text>
				</view>
				<view class="d_o_list">
					<text>下单时间</text>
					<text>{{info.order.createtime}}</text>
				</view>
			</view>
			<view class="d_order" v-if="info.order.expresscom||info.order.expresssn">
				<view class="d_o_title">退货信息</view>
				<view class="d_o_list">
					<text>快递公司</text>
					<text>{{info.order.expresscom}}</text>
				</view>
				<view class="d_o_list">
					<text>快递单号</text>
					<text :selectable="true">{{info.order.expresssn}}</text>
				</view>
			</view>

		</view>
		<view class="m_button" v-if="info.order.status=='1'" @click="onsubmit">确认核销</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id: '',
				info: {
					order: {
						address: {}
					},
					orderGoods: [],
				}
			}
		},
		onLoad(option) {
			this.id = option.id;
			this.getInfo();
		},
		methods: {
			onsubmit(){
				this.$axios('order/dh', 'POST', 'supplier', {
					id: this.id
				}).then(res => {
					if (res.data.code == 200) {
						this.$api.msg(res.data.data);
						setTimeout(()=>{
							this.getInfo();
						},1000)
					}
				})
			},
			getInfo() {
				this.$axios('order/getOrderInfo', 'POST', 'supplier', {
					id: this.id
				}).then(res => {
					if (res.data.code == 200) {
						this.info = res.data.data;
					}
				})
			},
			makePhoneCall() {
				var that = this;
				uni.makePhoneCall({
					phoneNumber: that.info.order.address.mobile

				});
			}
		}
	}
</script>

<style lang="scss">
	@import '/store/icon.css';

	page {
		background: #F2F2F2;
		color: $font-color-dark;
		padding-bottom: 130upx;
	}

	.details_wp {
		overflow: hidden;
	}

	.d_bg {
		background-color: $base-color;
		height: 200upx;
		position: absolute;
		margin-top: -4upx;
		width: 100%;
	}

	.d_body {
		padding: 20upx;
		position: relative;
		z-index: 50;
	}

	.d_buyers,
	.d_shop,
		{
		background-color: #fff;
		border-radius: 10upx;
		padding: 20upx;
		font-size: $font-base;
	}

	.d_b_info,
	.d_s_head,
	.d_s_body,
	.d_s_i_price,
	.d_s_list,
	.d_o_list {
		display: flex;
		align-items: center;
		padding: 20upx 0;
	}

	.d_b_info .yticon {
		background: rgba(0, 98, 204, 0.7);
		border-radius: 50%;
		color: #fff;
		padding: 15upx;
	}

	.d_b_address {
		padding-left: 20upx;
	}

	.d_b_name {
		color: $font-color-base;
		font-weight: normal;
		font-size: $font-sm;
		padding-top: 30upx;
	}

	.d_shop {
		font-size: 26upx;
		margin-top: 20upx;
	}

	.d_s_head {
		justify-content: space-between;
		font-size: $font-base;
	}

	.d_s_head .iconfont {
		font-size: $font-base;
	}

	.d_s_body {
		border-bottom: 1px hsl(0, 0%, 87%) solid;
	}

	.d_s_body image {
		border-radius: 10upx;
		height: 110upx;
		width: 110upx;
	}

	.d_s_i_info {
		flex: 1;
		padding-left: 10upx;
		line-height: 35upx;
	}

	.d_s_i_name {
		max-height: 68upx;
		overflow: hidden;
	}

	.d_s_i_price {
		justify-content: space-between;
		padding: 20upx 0 0;
	}

	.d_s_list {
		justify-content: space-between;
		padding: 20upx 0 0;
	}

	.d_s_list view:nth-of-type(1) {
		color: $font-color-base;
		padding-right: 30upx;
	}

	.d_s_list view:nth-of-type(2) {
		flex: 1;
		text-align: right;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.d_s_statistics {
		padding: 40upx 0;
		text-align: right;
	}

	.d_s_statistics text:nth-of-type(2) {
		color: $base-color;
	}

	.d_s_statistics text:nth-of-type(3) {
		color: $base-color;
		font-size: 20upx;
	}

	.d_order {
		background-color: #fff;
		border-radius: 10upx;
		margin-top: 20upx;
		padding: 20upx;
		line-height: 40upx;
	}

	.d_o_title {
		font-size: $font-base;
		padding-bottom: 10upx;
	}

	.d_o_list {
		padding: 0;
		justify-content: space-between;
	}

	.d_o_list text:nth-of-type(2) {
		color: $font-color-base;
	}
	.m_button{
		background: $base-color;
		border-radius: 10upx;
		color: #fff;
		margin: 0 3%;
		position: fixed;
		bottom: 30upx;
		text-align: center;
		letter-spacing: 1px;
		line-height: 70upx;
		width: 94%;
	}
</style>
